package com.hf.lookatme.zview.adapters;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.hf.lookatme.R;
import com.hf.lookatme.utils.DisplayUtils;
import com.hf.lookatme.zbean.LoginRecordData;

import java.util.List;

/**
 * Created by JoeShiguang on 2015/5/24.
 */
public class Adapter_ListView_LoginRecord extends BaseAdapter {

  private Context context;

  private List<LoginRecordData> list_loginRecords;

  public Adapter_ListView_LoginRecord(Context context, List<LoginRecordData> list_loginRecords) {
    this.context = context;
    this.list_loginRecords = list_loginRecords;
  }


  @Override
  public int getCount() {

    return list_loginRecords.size();
  }

  @Override
  public Object getItem(int i) {

    return list_loginRecords.get(i);
  }

  @Override
  public long getItemId(int i) {

    return i;
  }

  @Override
  public View getView(int i, View view, ViewGroup viewGroup) {

    if (list_loginRecords == null) {
      return null;
    }

    view = DisplayUtils.getView(context, R.layout.layout_item_listview_loginrecord);
    ViewHolder holder = new ViewHolder();
    holder.textView_record = (TextView) view.findViewById(R.id.textView_item_loginRecord_loginName);
    holder.textView_record.setText(list_loginRecords.get(i).getLoginName());
    return view;
  }


  private class ViewHolder {

    TextView textView_record;
  }
}
